package util;


import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;

public class SendMessageUtil {

    public static final String url = "http://gw.api.taobao.com/router/rest";
    public static final	String appkey = "23473071";
    public static final	String secret = "951efdcc9540d2c0c1646ed6d74892e6";



    public static boolean sendMsg(String phone , String content){
        DefaultTaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
        AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
        req.setSmsType("normal");
        req.setSmsFreeSignName("问道学院");
        req.setSmsParamString("{\"code\":\""+content+"\"}");
        req.setRecNum(phone);
        req.setSmsTemplateCode("SMS_127820118");
        try {
            AlibabaAliqinFcSmsNumSendResponse rsp = (AlibabaAliqinFcSmsNumSendResponse) client.execute(req);
            System.out.println(rsp.isSuccess());
            return true;
        } catch (ApiException arg10) {
            arg10.printStackTrace();
        }
        return false;
    }

//    public static void main(String[] args) {
//        SendMessageUtil.sendMsg("13147174932","top12123123123");
//    }


}

